package com.solcoo.customer.ui.level;

import android.os.Bundle;
import android.widget.ListView;

import com.solcoo.customer.Constant;
import com.solcoo.customer.R;
import com.solcoo.customer.base.BaseActivity;
import com.solcoo.customer.base.task.TaskHelper;
import com.solcoo.customer.base.task.TaskHelper.Callback;
import com.solcoo.customer.base.task.TaskHelper.DefaultCallback;
import com.solcoo.customer.model.LevelListDO;

public class LevelActivity extends BaseActivity {

	LevelAdapter adapter;

	private String shopNo;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.level);
		ListView levelList = (ListView) findViewById(R.id.level_list);
		adapter = new LevelAdapter(this);
		levelList.setAdapter(adapter);
		shopNo = getIntent().getStringExtra(Constant.IntentKey.SHOP_NO);
		TaskHelper.loadView(this, Constant.URL.getLevel(shopNo), callback,
				LevelListDO.class);
	}

	private Callback<LevelListDO> callback = new DefaultCallback<LevelListDO>(
			this) {

		@Override
		public void onSuccess(LevelListDO result) {
			adapter.update(result);
		}

	};
}
